<%@page import="java.util.ArrayList"%>
<%@page import="view.TarifaDTO"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ include file="header.jsp" %>
<div id='submenu'>
	<input type="button" value="Nueva" onclick="window.location='./tarifa'">   
</div>
<%
String msg =(String)request.getAttribute("msg");
if(request.getAttribute("msg")==null)
{
	msg = "";
}
ArrayList<TarifaDTO> listado = (ArrayList<TarifaDTO>)session.getAttribute("listado");
if (listado==null)
{
	listado = new ArrayList<TarifaDTO>(); 
}
%>
<!-- menu -->

<CENTER>
<br>
<table cellspacing="3" cellpadding="3" border="0" width="500">
	<tr>
		<td colspan="5" align="center"><%=msg%></td>
	</tr>	
</table>
<form action="./tarifas" method="post">
<input type="hidden" name="action" value="getTarifas"> 

<table cellspacing="0" cellpadding="0" border="1" bordercolor="lightgrey" width="500">
<tr>	
	<td>
<table cellspacing="0" cellpadding="3" border="0" width="500">
		<tr bgcolor="lightgrey">			
			<td colspan=4><h1>B&uacute;squeda de Tarifas<h1></td>
		</tr>
	<tr>
		<td align="left" width="100">Id</td>
		<td align="left" width="150"><input type="text" name="idHotel" id="idHotel" style="width: 150px" value="<%if(request.getParameter("idTarifa")!=null){%><%= (String)request.getParameter("idTarifa")%><%}%>"></td>		
		<td align="left" width="100">Categor&iacute;a</td>
		<td align="left" width="150">
			<select name="categoria" style="width: 150px">
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("0")) {%> selected <%} %> value="0">Todas</option>
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("1")) {%> selected <%} %>value="1">1 Estrella</option>
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("2")) {%> selected <%} %>value="2">2 Estrellas</option>
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("3")) {%> selected <%} %>value="3">3 Estrellas</option>
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("4")) {%> selected <%} %>value="4">4 Estrellas</option>
				<option <%if(request.getParameter("categoria")!=null && request.getParameter("categoria").equals("5")) {%> selected <%} %>value="5">5 Estrellas</option>
			</select> 
		</td>
	</tr>
	<tr>
		<td align="left">Nombre</td>
		<td align="left"><input type="text" name="nombre" id="nombre" style="width: 150px" value="<%if(request.getParameter("nombre")!=null){%><%= (String)request.getParameter("nombre")%><%}%>"></td>
		<td align="left">Estado</td>
		<td align="left">
			<select name="estado" style="width: 150px">
				<option <%if(request.getParameter("estado")!=null && request.getParameter("estado").equals("2")) {%> selected <%} %> value="2">Todos</option>
				<option <%if(request.getParameter("estado")!=null && request.getParameter("estado").equals("1")) {%> selected <%} %> value="1">Activo</option>
				<option <%if(request.getParameter("estado")!=null && request.getParameter("estado").equals("0")) {%> selected <%} %> value="0">Inactivo</option>
			</select> 
		</td>
	</tr>	
	<tr><td colspan="4" align="right"><input type="submit" value="Buscar"></td></tr>	
</table>
</td>
</tr>
</table>
</form>
<br>
<table cellspacing="0" cellpadding="0" border="1" bordercolor="AFAFAF" width="500">
	<tr bgcolor="#C4C4C4">
		<td align="center"><b>ID</b></td>
		<td align="center"><b>Nombre</b></td>
		<td align="center"><b>Hotel</b></td>
	</tr>
<%
for (TarifaDTO t : listado) 
{	
%>
	<tr >
		<td align="center">&nbsp;<%=t.getId() %></td>
		<td align="left"><a href="./tarifa?id=<%= t.getId() %>"><%= t.getNombre() %></a></td>									
		<td align="center"><%=t.getHotel().getNombre() %> - <%= t.getHotel().getDestino().getNombre() %>[<%= t.getHotel().getDestino().getPais() %>]</td>
	</tr>
<%			
}
%>
<tr>
	<td colspan="3" align="center">
		<%=String.valueOf(listado.size()) %>&nbsp;Registros
	</td>
	
</tr>
</table>
<BR>
<%@ include file="footer.jsp" %>